# !/usr/bin/python
# -*-coding:utf-8 -*-
"""
@File    :   run.py
@Create  :   2021/12/18 19:56
@Author  :   David
"""
import os
import unittest
from XTestRunner import HTMLTestRunner

from conf.const import BASE_DIR

if __name__ == "__main__":
    # 加载测试用例
    suite = unittest.defaultTestLoader.discover(os.path.join(BASE_DIR, 'tests'), pattern='test_*.py')
    with open(os.path.join(BASE_DIR, r'reports\report.html'), 'wb') as f:
        runner = HTMLTestRunner(stream=f, title='接口测试报告', description='用例执行情况:', language='zh-CN')
        runner.run(testlist=suite, rerun=1, save_last_run=False)
